import Vue from 'vue'
import VueRouter from 'vue-router'
import About from '@/pages/About'
import Home from '@/pages/Home'
import News from '@/pages/News'
import Message from '@/pages/Message'
import Detail from '@/pages/Detail'

Vue.use(VueRouter)

export default new VueRouter({
  mode:'history',
  routes:[
    {
      name:'guanyu',
      path:'/about',
      component:About,
    },
    {
      name:'zhuye',
      path:'/home',
      component:Home,
      children:[
        {
          name:'xinwen',
          path:'news',
          component:News
        },
        {
          name:'xiaoxi',
          path:'message',
          component:Message,
          children:[
            {
              name:'xiangqing',
              path:'detail/:school',
              component:Detail,
              // props的第一种写法，对象式
              // props:{x:999,y:666}

              // props的第二种写法，布尔值，含义是：将路由收到的所有的params参数以props的形式传给Detail
              // props:true

              // props的第三种写法，函数
              props:$route => ({...$route.query,...$route.params})

            }
          ]
        }
      ]
    },
  ]
})